import Vue from 'vue';
import Vuex from 'vuex'
Vue.use(Vuex);


export default new Vuex.Store({
    state:{
        user:{
            username:localStorage.getItem('user')==null?'未登录':JSON.parse(localStorage.getItem('user')).username,
            authorities:localStorage.getItem('user')==null?'未登录':JSON.parse(localStorage.getItem('user')).authorities
        },
        routers:[]
    },mutations:{
        login(state,user){
            state.user = user;
            localStorage.setItem('user',JSON.stringify(user));
        },initMenu(state,meuns){
            state.routers = meuns;
        }
    }
})
